const mongoose = require("mongoose");

mongoose.connect("mongodb://localhost:27017/zhizhe", {
  useNewUrlParser: true,
  useUnifiedTopology: true,
});

const db = mongoose.connection;

db.on("error", function () {
  console.log("error");
});
db.once("open", function () {
  console.log("mongo success");
});
module.exports = {
  mongoose,
  db,
};
